<template>
    <view>
        <u-row justify="start" gutter="5" customStyle="margin-left: 10px">
            <u-col span="2" textAlign="center">
                <u--text suffixIcon="arrow-down" iconStyle="font-size: 14px" :text="city" @click="switchLocation"></u--text>
            </u-col>
            <u-col span="9">
                <view class="search" @click="goSearch">
                    <u--text prefixIcon="search" iconStyle="font-size: 23px" text="小区、商圈、地铁站"></u--text>
                </view>
            </u-col>
        </u-row>
    </view>
</template>

<script>
    export default {
        name: "location",
        data(){
          return{
              city:" 合肥 "
          }
        },
        beforeCreate(){
            // 获取用户当前定位所在城市展示
        },
        methods:{
            goSearch(){
                let that = this;
                uni.$once('search',(data)=>{
                    that.$emit('search',data);
                });


                uni.navigateTo({
                    url: '/pages/user/index/search',
                })
            },

            switchLocation(){
                console.log('111');
            }
        }
    }
</script>

<style scoped>
    .search{
        display: flex;
        justify-content: left;
        width: 100%;
        height: 38px;
        background: #f4f4f5;
        padding-left: 20px;
        border: 1px solid #c8c7cc;
        border-radius: 20px;
    }
</style>